<?php
require_once './system/common.inc.php';

if(!$uid){
	header('Location: member.php?action=login');
	exit();
}

$s = $_GET['s'];
$query = DB::query("SELECT count(*) FROM songs WHERE title LIKE '%{$s}%' AND status='3'");
while($result = DB::fetch($query)) $counts = $result['count(*)'];
$Page = new Page($counts,10);
$Page->url = 'search.php?s='.$s.'&page=';
$query = DB::query("SELECT * FROM songs WHERE title LIKE '%{$s}%' AND status='3' ORDER BY `id` DESC LIMIT {$Page->firstRow},{$Page->listRows}");
$songs = array();
while($result = DB::fetch($query)) $songs[] = $result;

include template('search');